<?php
/**
 * User configuration management
 *
 * PHP version 5
 *
 * @category  PHP
 * @package   PHPMY
 * @author    Sven Ruttloff, www.sruttloff.de <service@sruttloff.de>
 * @copyright 2010 Sven Ruttloff, www.sruttloff.de
 * @license   http://www.sruttloff.de/cms/files/licence_en_lgpl.txt LGPL
 * @version   SVN: $Id: user.config.class.php 71 2010-06-18 11:18:56Z sruttloff $
 * @link      phpmy
 */
require_once dirname(__FILE__) . '/config.class.php';
/**
 * user config management
 *
 * @category  PHP
 * @package   ERP_Module_Skeleton
 * @author    Sven Ruttloff, www.sruttloff.de <service@sruttloff.de>
 * @copyright 2010 Sven Ruttloff, www.sruttloff.de
 * @license   http://www.sruttloff.de/cms/files/licence_en_lgpl.txt LGPL
 * @link      phpmy
 */
class userConfig extends config
{
    protected $USERID;
    /**
     * @var object instance
     */
    protected static $INSTANCE = array();
    /**
     * Load user config file into memory
     *
     * @param int $userid unique user id
     *
     * @return void
     */
    protected function __construct ($userid = null)
    {
        $this->path = WRITEABLEDIR . '/config/';
        if (isset($userid))
        {
            $this->filename = $userid . '.cfg';
            $this->load($userid);
        }
    }
    /**
     * return a instance of object
     *
     * @param string $userid user id or name to handle config
     *
     * @return object instance
     */
    public static function getInstance($userid = 'system')
    {
        if (!isset(self::$INSTANCE[$userid]))
            self::$INSTANCE[$userid] = new self($userid);
        return self::$INSTANCE[$userid];
    }
}